<?php

function smarty_function_get_all_category($params, &$smarty) {

    $pntables = pnDBGetTables();
    $tableCategory  = $pntables['innoforum_category'];
    $columncategory = $pntables['innoforum_category_column'];

    $sql = "SELECT
              $tableCategory.$columncategory[id],  
              $tableCategory.$columncategory[name]
            FROM
              $tableCategory
            ORDER BY 
              $tableCategory.$columncategory[name] ASC ";
    
    $column = array("category_id", "category_name");
    $result = DBUtil::executeSQL($sql);
    $categoryArray = DBUtil::marshallObjects ($result, $column);
 
    if ($categoryArray) {
        $smarty->assign('categoryArray', $categoryArray); 
    } else {
        return "";
    }
}